# Maintainer: Karel Gardas <karel@functional.vision>
pkgname=aravis
pkgver=0.8.31
pkgrel=0
pkgdesc="Aravis is a glib/gobject based library for video acquisition using Genicam cameras."
url="https://github.com/AravisProject/aravis"
# arm: sigbus
arch="x86 x86_64 aarch64 ppc64le"
license="LGPL-2.0-or-later"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	gst-plugins-base-dev
	gstreamer-dev
	gtk+3.0-dev
	libusb-dev
	libxml2-dev
	meson
	"
subpackages="$pkgname-dev $pkgname-libs $pkgname-viewer $pkgname-viewer-lang"
source="$pkgname-$pkgver.tar.xz::https://github.com/AravisProject/aravis/releases/download/$pkgver/aravis-$pkgver.tar.xz
	aravis-0.8.22.patch
	"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dusb=enabled \
		-Dviewer=enabled \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

viewer() {
	pkgdesc="$pkgdesc (camera viewer)"
	amove usr/bin/arv-viewer* \
		usr/lib/gstreamer-* \
		usr/share/applications \
		usr/share/icons \
		usr/share/metainfo
}

viewer_lang() {
	default_lang
	install_if="$subpkgname=$pkgver-r$pkgrel lang"
}

sha512sums="
11ff1afbf5728af945536134676b01b854dc0bda6cafd659e51334e816777905b6c3860de1f2b4030ca0c0ac6ca74f04a8ac6373bbb122553329a7781bc86908  aravis-0.8.31.tar.xz
b69356e9867b431d5c1a194c78dc188e5981dcb84683ebfc608cac0fbc5c6e9f773b5d14c69b81731925190a798c53f9eb1160b947711419aea8b22c4f1cafb0  aravis-0.8.22.patch
"
